//
//  HotTableViewCell.m
//  LPSNews
//
//  Created by luffy on 14-10-17.
//  Copyright (c) 2014年 LPS. All rights reserved.
//

#import "HotTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation HotTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor colorWithRed:249/255.0 green:249/255.0 blue:249/255.0 alpha:1.0];
        
        UIImageView * hotImageView = [[UIImageView alloc] init];
        UILabel * hotTitle = [[UILabel alloc] init];
        UIView * borderView = [[UIView alloc] init];
        hotImageView.contentMode = UIViewContentModeScaleAspectFill;
        hotImageView.clipsToBounds = YES;
        
        
        self.hotImageView = hotImageView;
        self.titleLabel = hotTitle;
        self.borderView = borderView;
        
        [self addSubview:borderView];
        [borderView addSubview:hotImageView];
        [borderView addSubview:hotTitle];
        
        [hotImageView release];
        [hotTitle release];
        [borderView release];
        
    }
    return self;
}
- (void)setHot:(HotModel *)hot
{
    [self.hotImageView sd_setImageWithURL:[NSURL URLWithString:hot.clientcover1] placeholderImage:[UIImage imageNamed:@"placeholderImage"] options:SDWebImageProgressiveDownload];
    
    self.borderView.frame = CGRectMake(10, 10, 300, 230);
    self.borderView.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.borderView.layer.borderWidth = 1;
    
    
    
    CGSize tempsize = CGSizeMake(300, 200);
    self.hotImageView.frame = (CGRect){CGPointZero,tempsize};
    
    // 大图的文字
    self.titleLabel.text = hot.setname;
    self.titleLabel.frame = CGRectMake(5,CGRectGetMaxY(self.hotImageView.frame)+5, [UIScreen mainScreen].bounds.size.width -20, 20);
    self.titleLabel.font = [UIFont systemFontOfSize:13];
    
}


- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
